package com.wwtech.epp.ui.activity.work.module;

import com.wwtech.epp.data.api.HttpAPIWrapper;
import com.wwtech.epp.entity.TaskDetail;
import com.wwtech.epp.ui.activity.base.ActivityScope;
import com.wwtech.epp.ui.activity.work.TaskListFragment;
import com.wwtech.epp.ui.activity.work.contract.TaskListContract;
import com.wwtech.epp.ui.activity.work.presenter.TaskListPresenter;
import com.wwtech.epp.ui.adapter.work.TaskListAdapter;

import java.util.ArrayList;

import dagger.Module;
import dagger.Provides;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: The moduele of TaskListFragment, provide field for TaskListFragment
 * @date 2017/10/04 11:54:28
 */
@Module
public class TaskListModule {
    private final TaskListContract.View mView;


    public TaskListModule(TaskListContract.View view) {
        this.mView = view;
    }

    @Provides
    @ActivityScope
    public TaskListPresenter provideTaskListPresenter(HttpAPIWrapper httpAPIWrapper, TaskListFragment mFragment) {
        return new TaskListPresenter(httpAPIWrapper, mView, mFragment);
    }

    @Provides
    @ActivityScope
    public TaskListFragment provideTaskListFragment() {
        return (TaskListFragment) mView;
    }

    @Provides
    @ActivityScope
    public TaskListAdapter provideTaskListAdapter() {
        return new TaskListAdapter(new ArrayList<TaskDetail>());
    }
}